import pygame,time,random
pygame.init()
screen=pygame.display.set_mode([700,700])
screen.fill([0,255,0])
pygame.display.flip()

fangkuaichange=70
fangkuaikuan=70

cao=[
[5,5],
[0,0,0,0,0],
[0,1,1,1,0],
[1,0,0,0,1],
[0,1,0,1,0],
[0,0,0,0,1],
]
caoc=[2,[256],[0,0,0]]
def drawtu(cao,x,y,c,daxiao,screen):
    d=True
    z=0
    a=c[z]
    b1=cao[0][0]
    b2=cao[0][1]
    while a>0:
        d=True
        z+=1
        cc=c[z]
        if cc[0]>255 or cc[0]<0:
            d=False
        y1=0
        x1=1
        r=True
        while r:
            rectc=cao[x1][y1]
            if rectc==z:
                if d:
                    pygame.draw.rect(screen,cc,[x+daxiao[0]*(x1-1),y+daxiao[1]*y1,daxiao[0],daxiao[1]],0)
            y1+=1
            if y1+1==b1:
                y1=0
                x1+=1
            if x1==b2:
                r=False
        a-=1

drawtu(cao,200,200,caoc,[10,10],screen)
pygame.display.flip()
r=True
while r:
    pygame.draw.rect(screen,[255,0,0],[0,0,30,20],0)
    for event in pygame.event.get():
        if  event.type == pygame.MOUSEBUTTONUP:
            if event.button==1:
                x1,y1=event.pos
                if x1<=30 and x1>0:
                    if y1<=20 and y1>0:
                        pygame.quit()
                        r=False
    if r:
        drawtu(cao,200,200,caoc,[10,10],screen)
        pygame.display.flip()


"""
pygame.draw.circle(screen, [aaaa,aaaaa,aaaaaa], [a,aa], aaa)
"""